package UI;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

// 文件工具类
public class FileUtils {
    public static String loadResource(String fileName) throws IOException {
        InputStream is = FileUtils.class.getResourceAsStream(fileName);
        if (is == null) {
            throw new IOException("找不到资源文件: " + fileName);
        }
        byte[] bytes = is.readAllBytes();
        return new String(bytes, StandardCharsets.UTF_8);
    }
}